﻿using Assets.Scripts.Example_2;
using UnityEngine;

namespace Assets.Scripts.Example5
{
    public class RayEntity : BaseBehaviour
    {
        RaycastHit[] hits1 = new RaycastHit[10];
        RaycastHit p_hit;

        public void OnUpdate(bool useUnAlloc)
        {
            Vector3Wrapper v = new Vector3Wrapper();
            Vector3 direct = new Vector3(0, -1, 0);
            Ray ray = new Ray(Vector3.zero, direct);
            RaycastHit hit;
            if (useUnAlloc)
            {
                Physics.RaycastNonAlloc(ray, hits1);
            }
            else
            {
                // RaycastHit[] hits2 = Physics.RaycastAll(ray, 100, 1);
                Physics.Raycast(ray, out p_hit);
                // RaycastHit[] hits2 = Physics.Raycast(ray, 100, 1);
            }
        }

    }
}